public class BootSink extends Sink {
public BootSink(Sink next) { this.next = next; }
public Stack<Choicepoint> fishFor(String name, int arity, Compound term, int choice, Prolog prolog, Unifier unifier, int cutIndex, Stack<Conjunct> continuation, Stack<Choicepoint> choicepoints) {
Choicepoint choicepoint;
int height = choicepoints.height;
if(arity == 0 && name.equals("true")) {
switch(choice) {
case 0: {
Compound t0 = new Compound("true");
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 2 && name.equals("=")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Compound t0 = new Compound("=", t1, t1);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 1 && name.equals("call")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Compound t0 = new Compound("call", t1);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t1);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 2 && name.equals(",")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Variable t2 = new Variable("V1");
Compound t0 = new Compound(",", t1, t2);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t1, t2);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 2 && name.equals("->")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Variable t2 = new Variable("V1");
Compound t0 = new Compound("->", t1, t2);
Compound t3 = new Compound("!");
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t1, t3, t2);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 2 && name.equals(";")) {
switch(choice) {
case 0: {
Variable t2 = new Variable("V0");
Variable t3 = new Variable("V1");
Compound t1 = new Compound("->", t2, t3);
Variable t4 = new Variable("V2");
Compound t0 = new Compound(";", t1, t4);
Compound t5 = new Compound("!");
Compound t9 = new Compound("!");
Compound t8 = new Compound(",", t9, t3);
Compound t7 = new Compound(",", t2, t8);
Compound t6 = new Compound(";", t7, t4);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height, t5, t6);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 1: {
Variable t1 = new Variable("V0");
Variable t2 = new Variable("V1");
Compound t0 = new Compound(";", t1, t2);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height, t1);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 2: {
Variable t1 = new Variable("V0");
Variable t2 = new Variable("V1");
Compound t0 = new Compound(";", t1, t2);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t2);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 1 && name.equals("\\+")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Compound t0 = new Compound("\\+", t1);
Compound t2 = new Compound("call", t1);
Compound t3 = new Compound("!");
Compound t4 = new Compound("fail");
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height, t2, t3, t4);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 1: {
Variable t1 = new Variable("V0");
Compound t0 = new Compound("\\+", t1);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 2 && name.equals("\\=")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Variable t2 = new Variable("V1");
Compound t0 = new Compound("\\=", t1, t2);
Compound t4 = new Compound("=", t1, t2);
Compound t3 = new Compound("\\+", t4);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t3);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 2 && name.equals("=>")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Variable t2 = new Variable("V1");
Compound t0 = new Compound("=>", t1, t2);
Compound t5 = new Compound("call", t1);
Compound t7 = new Compound("call", t2);
Compound t6 = new Compound("\\+", t7);
Compound t4 = new Compound(",", t5, t6);
Compound t3 = new Compound("\\+", t4);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t3);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 2 && name.equals("==")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Variable t2 = new Variable("V1");
Compound t0 = new Compound("==", t1, t2);
Compound t3 = new Compound("var", t1);
Compound t4 = new Compound("var", t2);
Compound t8 = new Compound("chalk");
Compound t7 = new Compound("=", t1, t8);
Compound t10 = new Compound("cheese");
Compound t9 = new Compound("=", t2, t10);
Compound t6 = new Compound(",", t7, t9);
Compound t5 = new Compound("\\+", t6);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height, t3, t4, t5);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 1: {
Variable t1 = new Variable("V0");
Variable t2 = new Variable("V1");
Compound t0 = new Compound("==", t1, t2);
Variable t4 = new Variable("V2");
Variable t5 = new Variable("V3");
Compound t3 = new Compound("functor", t1, t4, t5);
Compound t6 = new Compound("functor", t2, t4, t5);
Variable t10 = new Variable("V4");
Variable t11 = new Variable("V5");
Compound t9 = new Compound("arg", t10, t1, t11);
Variable t13 = new Variable("V6");
Compound t12 = new Compound("arg", t10, t2, t13);
Compound t8 = new Compound(",", t9, t12);
Compound t14 = new Compound("==", t11, t13);
Compound t7 = new Compound("=>", t8, t14);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t3, t6, t7);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 2 && name.equals("expand_term")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Variable t2 = new Variable("V1");
Compound t0 = new Compound("expand_term", t1, t2);
Compound t5 = new Compound("term_expansion", t1, t2);
Compound t6 = new Compound("true");
Compound t4 = new Compound("->", t5, t6);
Compound t7 = new Compound("=", t1, t2);
Compound t3 = new Compound(";", t4, t7);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t3);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 0 && name.equals("repeat")) {
switch(choice) {
case 0: {
Compound t0 = new Compound("repeat");
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 1: {
Compound t0 = new Compound("repeat");
Compound t1 = new Compound("repeat");
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t1);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 1 && name.equals("consult")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Compound t0 = new Compound("consult", t1);
Variable t3 = new Variable("V1");
Compound t2 = new Compound("parse_file", t1, t3);
Compound t5 = new Compound("assert");
Compound t4 = new Compound("maplist", t5, t3);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t2, t4);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
return next.fishFor(name,arity,term,choice,prolog,unifier,cutIndex,continuation,choicepoints);
}
}
